<?php
//dezend by http://www.yunlu99.com/ QQ:270656184
defined('BASEPATH') || exit('No direct script access allowed');
class Account extends MY_Controller
{
	public function __construct()
	{
		parent::__construct();
		$this->verify_user();
	}

	public function index()
	{
		$d['area'] = $this->d->rows(array('table' => 'area'));
		$this->show(array('header', 'user_left', 'user_info', 'footer'), $d);
	}

	public function save()
	{
		$nickname = $this->input->post('nickname');
		$address = $this->input->post('address');
		$company = $this->input->post('company');
		$intro = $this->input->post('intro');
		$sex = $this->input->post('sex');
		$area_code = $this->input->post('area_code');
		$data['nickname'] = $nickname;
		$data['address'] = $address;
		$data['company'] = $company;
		$data['intro'] = $intro;
		$data['sex'] = $sex;
		$data['area_code'] = $area_code;
		$rs = $this->db->where('id', $this->user['id'])->update('user', $data);

		if ($rs) {
			ajax_return(0, '保存成功');
		}
		else {
			ajax_return(1, '保存失败');
		}
	}
}

?>
